{include file="index/header" /}
<style type="text/css">
	.input_price{width: 8%;}
	.input_remarks{width: 50%}
	.hide{display: none;}
	.input_type{width:50%;padding: 10px;border-radius: 5px;border: 1px solid #ddd;margin-bottom: 15px;}
</style>
<body>
	<div class="panel admin-panel margin-top" id="add">
		<div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 增加内容</strong></div>
		<div class="body-content">
			<form method="post" class="form-x" action=""  enctype="multipart/form-data">
				<div class="form-group">
					<div class="label">
						<label>手机号：</label>
					</div>
					<div class="label" style="width:5%;overflow:inherit">
						<label>{$data.know_phone ?: $data.know_email}</label>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>选择身份：</label>
					</div>
					<div class="field">
						<div class="button-group radio">
							<input name="status" value="1" type="radio" {if $status eq 1}  checked="checked" {/if} class="radio_status">超级会员
							<input name="status" value="2"  type="radio" {if $status eq 2}  checked="checked" {/if} class="radio_status">单课程
							<input name="status" value="0" type="radio" {if $status eq 0}  checked="checked" {/if} class="radio_status">取消身份
						</label>
					</div>
				</div>
			</div>
			{include file="user/nav_price" /}
			<div class="form-group nav_year">
				<div class="label">
					<label>会员年限：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" style="width: 340px;" value="{$user_vip.year}" name="year" placeholder="默认不填(超级会员默认是10 单课程默认是2)" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label></label>
				</div>
				<div class="field">
					<button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
				</div>
			</div>
		</form>
	</div>
</div>
</body></html>
<script type="text/javascript">
	$('.nav').click(function(){
		var nav_id = $(this).val();
		if($(this).is(':checked') == true){
			$('.input_vip'+nav_id).show();
			$('.input_br'+nav_id).show();
		}else{
			$('.input_vip'+nav_id).hide();
			$('.input_br'+nav_id).hide();
		}
	});
	$('.radio_status').click(function(){
		var show = $('input:radio[name="status"]:checked').val();
		$('.nav_price').hide();
		$('.nav_year').show();
		if(show == 0) $('.nav_year').hide();
		$('.user_vip').hide();
		if(show == 1){
			$('.user_type').show();
		}else if(show != 0){
			$('.nav_price').show();
			if(show == 5) $('.user_type').show();
		}
	});
	$('.types').click(function(){
		$('.input_type').hide();
		if($(this).is(':checked') == true) $(this).next().show();
	});
	$('.class_nav input').click(function(){
		if($(this).is(':checked') == true) {
			var nav_id = $(this).parent().data('id');
			var study_num = $('.input_study'+nav_id).val();
			study_num = study_num ? study_num+','+$(this).data('study') : $(this).data('study');
			$('.input_study'+nav_id).val(study_num);
		}
	});
	$('.input_package').change(function(){
		var money = $(this).find("option:selected").data('money');
		var nav_id = $(this).data('id');
		$('.input_money'+nav_id).val(money);
	});
	$(document).ready(function(){
		var class_nav = $('.class_nav');
		for (var i = class_nav.length - 1; i >= 0; i--) {
			console.log(i);
			var nav_id = $(class_nav[i]).data('id');
			console.log(nav_id);
			var study = $(class_nav[i]).find("input");
			var study_num = [];
			if(study) for (var is = 0; is < study.length ; is++) {
				if($(study[is]).prop('checked')) study_num.push($(study[is]).data('study'));
			}
			if(study_num){
				$('.input_study'+nav_id).val(study_num.join());
			}
		}
	});
	
</script>